package com.demo.petshop.controller;

import com.demo.petshop.entity.StoreTags;
import com.demo.petshop.service.StoreTagsService;
import com.mybatisflex.core.paginate.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.Serializable;
import java.util.List;

/**
 *  控制层。
 *
 * @author lenovo
 * @since 2025-06-11
 */
@RestController
@RequestMapping("/storeTags")
public class StoreTagsController {

    @Autowired
    private StoreTagsService storeTagsService;

    @PostMapping("save")
    public boolean save(@RequestBody StoreTags storeTags) {
        return storeTagsService.save(storeTags);
    }

    @DeleteMapping("remove/{id}")
    public boolean remove(@PathVariable Serializable id) {
        return storeTagsService.removeById(id);
    }

    @PutMapping("update")
    public boolean update(@RequestBody StoreTags storeTags) {
        return storeTagsService.updateById(storeTags);
    }

    @GetMapping("list")
    public List<StoreTags> list() {
        return storeTagsService.list();
    }

    @GetMapping("getInfo/{id}")
    public StoreTags getInfo(@PathVariable Serializable id) {
        return storeTagsService.getById(id);
    }

    @GetMapping("page")
    public Page<StoreTags> page(Page<StoreTags> page) {
        return storeTagsService.page(page);
    }

}
